home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 054a / wincmd.zip / 2CLIP.WCM next >
Text File  |  1993-04-07  |  1KB  |  47 lines

  1.  
  2. //-----------------------------------------------------
  3. // 2CLIP.WCM--WinCmd program that copies a text file into
  4. // the Windows Clipboard.
  5. //-----------------------------------------------------
  6. //
  7. // Ask user for file name.  Default to blank
  8. //
  9. ans = AskBox ("Enter the name of the file to copy into the clipboard"," ")
  10. //
  11. // If user pressed the Cancel button, quit
  12. //
  13. if ans+a == a
  14.    exit
  15. //
  16. // Start NotePad
  17. //
  18. notepad
  19.  
  20. //
  21. // Send keys to notepad to read in the file
  22. //
  23. sendkeys ("%fo")         //Display the file open dialog box
  24. sendkeys (ans)           //Enter file spec
  25. sendkeys ("{enter}")     //Open the file.
  26. //
  27. // See if notepad read the file.  If it didn't, the warning box
  28. // for the "Open" dialog will be active, and GetAppActive() will
  29. // return "Open".  In that case, close notepad and tell the user
  30. //
  31. winact = Getappactive()
  32. if (winact = "Open") do
  33.    sendkeys ("{enter}")  //Close the warning box
  34.    sendkeys ("{esc}")    //Close the file open box
  35.    ok = fail
  36. end
  37. else do
  38.    sendkeys ("%ea")      //Select all the text
  39.    sendkeys ("%ec")      //Copy the data into the clipboard
  40.    ok = pass
  41. end
  42. sendkeys ("%fx")         //Close notepad
  43. if (ok = fail)
  44.    msgbox ("Notepad could not access the file you requested.  Nothing was copied into the clipboard", "Error!", 0)
  45.  
  46. exit
  47.